﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmbeddedSharp.Core;
using System.Windows.Forms;

namespace Zove.Scripting.Guikit {
    public class RadioButtonListDialogNode : FuncNode {

        public RadioButtonListDialogNode()
            : base() {
            base.Value = "OptionDialog";
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new Exception("usage: OptionDialog(title, message)");
            }

            string message = Parameters[1].Evaluate().ToString();
            string title = Parameters[0].Evaluate().ToString();
            RadioButtonListDialog d = new RadioButtonListDialog(title, message);
            if (d.ShowDialog() == DialogResult.OK) {
                return d.Result;
            }

            return string.Empty;
        }
    }
}
